﻿### Setting for Verbose Logging
### Turn Verbose ON:  Continue
### Turn Verbose OFF: SilentlyContinue
$VerbosePreference = 'Continue'

if (-not $fimwf)
{
    Throw "Failed to get workflow details from the FIM Request"
}
Write-Verbose "Processing FIM WF with RequestId: $fimwf"

###
### Load the FIM PowerShell Module
###
Write-Verbose "Loading the FIM Service Config Module from: C:\CodePlex\FimPowerShellModule"
Import-Module C:\CodePlex\FimPowerShellModule\FimPowerShellModule.psm1 -Verbose:$false

### 
### Get the Request
### 
Write-Verbose ("Getting the Request by ObjectID: {0}" -F $fimwf.RequestId.Guid)
$Request = Export-FimConfig -Custom ("/*[ObjectID='{0}']" -F $fimwf.RequestId.Guid) | 
    Convert-FimExportToPSObject 

###
### Write-Verbose the Request details - this will end up in the WF DLL Trace Output
###    
$Request | Out-String -Width 100 | Write-Verbose

###
### Save the Request details to a file for later
###
$Request | Export-Clixml -Path ("C:\Temp\RequestDetails.{0}.clixml" -F $fimwf.RequestId.Guid)
